﻿@model  IEnumerable<Logic.Models.WorkItem>

@{
    Layout = null;
}


    <script src="@(Logic.Constants.CurrentUrl)/Scripts/projectTable.js" type="text/javascript"></script>
    <div id="tableContainer">
    </div>
    <script type="text/javascript">

        function stringFormat(str, arr)
        {
            if (!$.isArray(arr))
                arr = $.grep(arguments, function (item, index) { return index != 0; });
            
            return str.replace(/\{([0-9]+)\}/g, function (wholematch, firstmatch)
            {
                return arr[(+firstmatch)];
            });
        }

        var projects =  @(Html.Raw(Logic.Extentions.ToJson(Model)));
        var states =  @(Html.Raw(Logic.Extentions.ToJson(Enum.GetNames(typeof(Logic.ClarizenSvc.WorkItemState)))));
        var roles = @(Html.Raw(Logic.Extentions.ToJson(Enum.GetNames(typeof(Logic.ClarizenSvc.WorkItemFilter)))));
        var pTable = new ProjectTable('#tableContainer',states, roles, function(parentID, type, func)
        {
            remoteRequest("@(Logic.Constants.CurrentUrl)/Projects/WorkItemChildren", "JSON", "POST", {parentID:parentID,parentType:type}, function (data)
            {
                func(data);
            });
        },
        function(filter, state, role)
        {
            remoteRequest("@(Logic.Constants.CurrentUrl)/Projects/WorkItemChildren", "JSON", "POST", {filter:filter,state:state,role:role}, function (data)
            {
                func(data);
            });
        }, '@(Logic.Constants.CurrentUrl)');
        pTable.render(projects);
        
        
    </script>


    <style>
        #tableContainer     {font-size:13px}
        .projectTable       {font-size:12px;border: 3px solid #8FC6FF;-moz-border-radius: 5px;-webkit-border-radius: 5px;}
        .projectTable tr td {border-bottom:solid 1px #EFEFEF; color:#666; padding:3px 6px}
        .projectTable .typeImg  {margin-right:5px}
        .projectTable img       {}
        .projectTable .SelectedRow  {background-color: rgb(206, 228, 255)}
        
        .projectTable .header       {background: url("@(Logic.Constants.CurrentUrl)/Images/BGHeader.gif") repeat-x; background-position:0px -57px ; height:22px}
        .projectTable .header td    {border-right:solid 1px #dEf4FF; text-align:center}
    </style>
